/****************************************************************************

	COPYRIGHT(C) MAXSI SOFTWARE, JONAS 'SORTIE' TERMANSEN 2008, 2009, 2010

    This file is part of Maxsi Distribution.

    Maxsi Distribution is free software: you can redistribute it and/or modify
    it under the terms of the GNU Lesser General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    Maxsi Distribution is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU Lesser General Public License for more details.

    You should have received a copy of the GNU Lesser General Public License
    along with Maxsi Distribution. If not, see <http://www.gnu.org/licenses/>.

	*/ #include "MaxsiDistributionContributors.h" /*

	If you modify this file, please enter your name below and provide contact
	information in MaxsiDistributionContributors.h. For more information please see
	MaxsiDistributionContributors.h.
	
	Contributors to this file:

	- Jonas 'Sortie' Termansen
	- [your name here]

	MaxsiDistribution.dll
	Distributing since 2008

	MaxsiDistributionInterface001.h
	An interface to the Maxsi Distribution Platform.

****************************************************************************/

#ifndef MaxsiDistributionInterface001_H
#define MaxsiDistributionInterface001_H

//=============================================================================
// Undef all redirections to previous versions of this interface and make sure
// all the interfaces we refer to are properly versioned here. It doesn't
// matter if these interfaces are not the newest versions, just as long as
// as these def's refer to the used versions.
//=============================================================================
// Maxsi Distribution Module
#ifdef MaxsiDistributionModule
#undef MaxsiDistributionModule
#endif
#define MaxsiDistributionModule MaxsiDistributionModule001

// Maxsi Distribution Interface
#ifdef MaxsiDistributionInterface
#undef MaxsiDistributionInterface
#endif
#define MaxsiDistributionInterface MaxsiDistributionInterface001

//=============================================================================
// Declare the Interface.
//=============================================================================
MD_DECLARE_INTERFACE_H(MaxsiDistributionInterface);

//=============================================================================
// Maxsi Distribution Interface
//=============================================================================
class	MaxsiDistributionInterface
{
public:
	MaxsiDistributionInterface();
	~MaxsiDistributionInterface();

	//=============================================================================
	//	bool	RegisterModule(MaxsiDistributionModule* Module);
	//
	//	Module is added to the array of MD-extension modules accessed with the
	//	MaxsiDistributionModule interface.
	//=============================================================================
	
	virtual bool	RegisterModule(MaxsiDistributionModule* Module) MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	Initialize(char** Variables, size_t NumVariables);
	//
	//	Sets a series of variables inside Maxsi Distribution.
	//=============================================================================

	virtual	bool	Initialize(MESTR** Variables, size_t NumVariables) MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	CreateSession();
	//
	//	Terminates all data belonging to previous sessions and creates a new default
	//	session. A ses
	//=============================================================================

	virtual bool	CreateSession() MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	SaveSession(char** OutBuffer, size_t* OutBufferLength);
	//
	//	Exports a buffer with all the session-data this module needs to store
	//	permanently for this session specificly. The application should take care
	//	of storing this and passing it onto RestoreSession() when the session is
	//	restored. OutBuffer points to a	char* which will be changed to point to a
	//	buffer containing OutBufferLength bytes that should be saved. Call
	//	SavedSession() when done with the buffer.
	//=============================================================================

	virtual bool	SaveSession(char** OutBuffer, size_t* OutBufferLength) MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	SavedSession(char* OutBuffer, size_t OutBufferLength);
	//
	//	Deletes the buffer allocated for use by the application when SaveSession()
	//	is called. You must call SavedSession() when done with the buffer.
	//=============================================================================
	
	virtual bool	SavedSession(char* OutBuffer, size_t OutBufferLength) MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	RestoreSession(char* OutBuffer, size_t OutBufferLength);
	//
	//	Restores a previous session.
	//=============================================================================

	virtual bool	RestoreSession(char* Buffer, size_t BufferLength) MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	IsInitialized();
	//
	//	Returns true if ->Initialize() has already been run. Returns false if it
	//	haven't and should be run.
	//=============================================================================

	virtual	bool	IsInitialized() MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	IsDisabled();
	//
	//	Returns true if Maxsi Distribution is disabled. (Meaning that Maxsi
	//	Distribution may not access the Internet - all other Maxsi Distribution
	//	features are running).
	//=============================================================================

	virtual	bool	IsDisabled() MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	IsEnabled();
	//
	//	Returns true if Maxsi Distribution is enabled.  (Meaning that Maxsi
	//	Distribution may  access the Internet).
	//=============================================================================

	virtual	bool	IsEnabled() MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	Disable();
	//
	//	Disables Maxsi Distribution (prevents Maxsi Distribution from accessing
	//	the Internet).
	//=============================================================================

	virtual	bool	Disable() MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	Enable();
	//
	//	Enables Maxsi Distribution (allows Maxsi Distribution to access	the
	//	Internet).
	//=============================================================================

	virtual	bool	Enable() MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	UpdateProduct();
	//
	//	Connects, if possible, to a content server and checks if the current version
	//	of this product is up to date. If it's not, the thread exits and this function
	//	returns false. If it's safe to launch the product the function returns true.
	//=============================================================================

	virtual	int		UpdateProduct() MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	ReportCrashes();
	//
	//	Scans for crash minidumps (.mdmp's) related to this product and uploads
	//	any new crashes to a content server.
	//=============================================================================

	virtual	bool	ReportCrashes() MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	SDKMsg(char* Message);
	//
	//	Sends a message to the client app console.
	//=============================================================================

	virtual	bool	SDKMsg(char* Message) MD_DLL_INTERFACE;

	//=============================================================================
	//	bool	SDKMsgDebug(char* Message);
	//
	//	Sends a message to the client app console if debug information is enabled
	//	in the SDK.
	//=============================================================================

	virtual	bool	SDKMsgDebug(char* Message) MD_DLL_INTERFACE;

public:
	bool	m_Initialized;
	bool	m_IsEnabled;

};


#endif